<?php 
require_once './model/db.php';
require_once './model/categories.php';
require_once './model/addarticles.php';
$obj = new categories();
$data = $obj->xemca();
$open = new addcategories();

if(isset($_POST["ok"]))
    {
        $open->addar();
        $ne = "them thanh cong";
    }
?>
<form method="post">
    <table class="addar">
       
    <tr>
        <td>Title</td>
        <td><input type="text" name="title"></td>
    </tr>
    <tr>
        <td>overview</td>
        <td><input type="text" name="overview"></td>
    </tr>
    <tr>
        <td>body</td>
        <td><input type="text" name="body"></td>
    </tr>
    <tr>
        <td>category</td>
   
        <td>
            <select name="categories">
            <?php foreach($data as $value){ ?>
            
                <option value="<?php echo $value["id"] ?>"><?php echo $value["name"] ?></option>
            <?php } ?>
            </select>
        </td>
           
    </tr>
    <tr>
        <td colspan="2"><input type="submit" name="ok" value="ADD"></td>
         <?php if(isset($ne)) echo $ne; ?>
    </tr>
</table>
</form>


